<?php
//include_once "../config/config.php";
require_once(GAME_CONFIG_FILE);
require_once(UTILS_FILE);

class PlacedCard
{
	private $_id;
	private $_hp;   // life
	
	public function __construct($id, $hp) {
		$this->_id = $id;
		$this->_hp = $hp;
	}
	
        //  reduce life to card
	public function take_damage($dmg) {
		$this->_hp -= $dmg;
                if($this->_hp < 0) {
			return $this->_hp;	//if dead + exist dmg transfer to next soldier
		}
                if($this->_hp > 0) {
			return $this->_hp;	//alive + dont dmg transfer to next soldier
		}
                if($this->_hp == 0) {
			return $this->_hp;	//if dead + dont dmg transfer to next soldier
		}
		return null;	//is alive
	}
	
	public function ID() { return $this->_id; }
	public function HP() { return $this->_hp; }
	
	public function __toString() {
		return "id: $this->_id, hp: $this->_hp";		
	}
}
?>